#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <time.h>

#include "kylin-activation.h"
#include "text-i18n.h"

/*
 * kylin_activation_print_result_message, print message according to result number
 */
extern void kylin_activation_print_result_message(int result);

/*
 * kylin_activation_activate_check, check activation status and print
 * return 1 if system is under activated status or on trial and set result with NO_ERROR, or 0 if not and set result
 */
extern int kylin_activation_activate_check(int *result);

/*
 * redirect_stdio, redirect stdin, stdout, stderr to /dev/null if they don't exist
 */
extern void redirect_stdio();

int main(int argc, char** argv)
{
	int ret;
	int result;

	setlocale(LC_MESSAGES, "");
	bindtextdomain (PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);
	bind_textdomain_codeset(PACKAGE, "utf8");

	redirect_stdio();

	ret = kylin_activation_activate_check(&result);
	if(result != NO_ERROR)
	{
		kylin_activation_print_result_message(result);
		exit(result);
	}

	(void)ret;
	//exit(!ret);
	exit(0);
}
